package com.changzhi.controller;

import com.changzhi.common.annotation.Verify;
import com.changzhi.common.util.Result;
import com.changzhi.ldyl.model.dto.BaseDto;
import com.changzhi.service.SweetService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Description:甜蜜告白
 * @author: 小落
 * @date: 2021年02月25日
 */
@Slf4j
@CrossOrigin
@RestController
@RequestMapping("sweet")
public class SweetController {

	@Autowired
	private SweetService sweetService;

	@Verify(timestamp = false)
	@PostMapping("rankings")
	public Result rankings(@RequestBody @Validated BaseDto baseDto){
		return Result.success(sweetService.rankings(baseDto.getUserId()));
	}

	@Verify(timestamp = false)
	@PostMapping("task")
	public Result task(@RequestBody @Validated BaseDto baseDto){
		return Result.success(sweetService.task(baseDto.getUserId()));
	}
}
